package com.cd.socialMarketing.web;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.cd.socialMarketing.model.Estado;
import com.cd.socialMarketing.service.generic.IGenericManager;

@Controller
public class IndexController {

	@Autowired
	@Qualifier(value="estadoManager")
	private IGenericManager<Long, Estado> estadoManager;
	
	@RequestMapping(value="/index.htm")
	public ModelAndView populateIndex(HttpServletRequest request) {
		Map<String, Object> modelo = new HashMap<String, Object>();
		
		modelo.put("estados", estadoManager.list());
		
		return new ModelAndView("index", "modelo", modelo);
	}
	
}
